# CMake lowest version requirement
cmake_minimum_required(VERSION 2.8)

#  project information
set(PROJECT_NAME linzhong)
PROJECT(${PROJECT_NAME})

if(NOT DEFINED ENV{DDK_PATH})
	set(ENV{DDK_PATH} /home/pass/tools/che/ddk/ddk)
endif()
message("ddk dir:$ENV{DDK_PATH}")
message("main dir:${PROJECT_SOURCE_DIR}")

# Set compiler
set(CMAKE_C_COMPILER "/usr/bin/aarch64-linux-gnu-gcc")
set(CMAKE_CXX_COMPILER "/usr/bin/aarch64-linux-gnu-g++")

# Compile options
add_compile_options(-std=c++11)
set(ENV{CXXFLAGS} "")

set(CMAKE_BUILD_TYPE "release")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O2 -Wall")

# Header path
include_directories(
        ${PROJECT_SOURCE_DIR}
        ${PROJECT_SOURCE_DIR}/common/include
        $ENV{DDK_PATH}/include/inc
        $ENV{DDK_PATH}/include/third_party/opencv/include
        $ENV{DDK_PATH}/include/third_party/protobuf/include
        $ENV{DDK_PATH}/include/third_party/cereal/include
        $ENV{DDK_PATH}/include/libc_sec/include
)

# Link path
link_directories("$ENV{DDK_PATH}/host/lib")
link_directories("${PROJECT_SOURCE_DIR}/out")
set(link_library
    libhiai_server.so
    libmatrixdaemon.so
    libome.so
    libfmk_common.so
    libdrvdevdrv.so
    libdrvaicpu.so
    libdrvhdc.so
    libdrvhdc_host.so
    libdrvtcp.so
    libmmpa.so
    libcrypto.so
    libc_sec.so
    libruntime.so
    libteec.so
    libpthread.so
    libcce.so
    libcce_aicpudev.so
    libcce_aicore.so
    libaicpu_engine.so
    libprotobuf.so
    librt.so
    libprofilerclient.so
    libslog.so
    libdl.so
    libmedia_mini.so
    libdevmm.so
)


add_subdirectory(${PROJECT_SOURCE_DIR}/style_type_register)